import {
	ListViewActionType,
	IListViewStore,
	IListViewController,
	IListAbility,
	IListViewAbility,
	IParam,
} from '@/core/interface';
import { MDViewController } from './md-view-controller';

export class ListViewController
	extends MDViewController<ListViewActionType, IListViewStore, IListViewAbility>
	implements IListViewController<IListViewStore, IListViewAbility>
{
	/**
	 * 获取表格部件能力
	 *
	 * @protected
	 * @return {*}  {(IListAbility | undefined)}
	 * @memberof GridViewController
	 */
	protected getMDCtrlAbility(): IListAbility | undefined {
		const list = this.model.ctrls.find(
			(ctrl: IParam) => ctrl.controlType === 'LIST'
		);
		if (list) {
			return this.getSubAbility<IListAbility>(list.name);
		}
		return undefined;
	}
}
